#include "smalliconitem.h"
#include "ui_smalliconitem.h"

SmallIconItem::SmallIconItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SmallIconItem)
{
    ui->setupUi(this);
}

SmallIconItem::~SmallIconItem()
{
    delete ui;
}

void SmallIconItem::setImage()
{
    // 可以修改为当模式为模版时, 读取模版图片, 否则采用默认图片
    QPixmap pixmap(":/action/images/model.png");
    pixmap = pixmap.scaled(ui->label->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    ui->label->setPixmap(pixmap);
}

void SmallIconItem::setText(const QString& name, QString date)
{
    ui->labelName->setText(name);
    ui->labelDate->setText(date.left(10));
}

void SmallIconItem::setItemSize(QSize size)
{
    ui->label->setMinimumSize(size);
    ui->label->setMaximumSize(size);
}
